function twoSum(numbers, target) {
    let ans = []
    while (numbers.length > 0) {
        let i=numbers.pop()
        let f = numbers.indexOf(target-i)
        if(f!=-1){
            ans.push(f,numbers.length)
            break;
        }
    }
    return ans
}



console.log(twoSum([1, 2, 3], 4));